package thebesttaskmanager.tstore;


import static org.junit.Assert.assertEquals;

import java.util.ArrayList;

import org.junit.Before;
import org.junit.Test;

public class TStoreTest {
  
  private TStore tstore;

  
  @Before
  public void setup() {
    tstore = new TStore("test.db");
  }
  @Test
  public void testReadWriteFile() {
    //test if function exists
    ArrayList<String> data = tstore.readFile();
    tstore.writeFile(data);
    
    
    //test read and write function
    data = new ArrayList<String>();
    data.add("this is line 1");
    data.add("this is line 2");
    tstore.writeFile(data);
    
    ArrayList<String> data2 = tstore.readFile();
    for (int i=0;i<data2.size();i++) {
      assertEquals("readFile or writeFile error",data.get(i),data2.get(i));
    }
  }


}
